﻿using System.Collections.Generic;
using System.Linq;
using FazaDemo.BL.InterfaceDomain;
using FazaDemo.BL.Services_;
using FazaDemo.Data;
using FazaDemo.QL.AbstractQueryModel;

namespace FazaDemo.QueryModel
{
    public class NavigatorRepository : IQueryRepository<int, NavigatorCondition>
    {

        private INavCondConverter _converter;

        public NavigatorRepository()
        {
            _converter = new NavCondConverter();
        }

        public NavigatorCondition Get(int context)
        {
            var ecqText = string.Empty;
            using (var dbContext = new FazaEntities1())
            {
                ecqText = dbContext.Set<TS_SYS_ECQ>().First(e => e.ID == context).ECQ;
            }
            return _converter.GenerateCondition(ecqText);
        }

        public IList<NavigatorCondition> Get()
        {
            return null;
        }

    }
}
